package com.JavaWk4_2;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class work4_2 {
    public static void main(String[] args) {
        Map<Integer, Student> mp = new TreeMap<Integer, Student>();
        Set<Integer> st;

        mp.put(1, new Student("Lucy", 20));
        mp.put(4, new Student("John", 21));
        mp.put(5, new Student("Smith", 20));
        mp.put(3, new Student("Aimee", 19));
        mp.put(2, new Student("Amanda", 21));

        st = mp.keySet();

        for(Integer i : st){
            System.out.println(i + " " + mp.get(i));
        }
    }
}

class Student{
    private String stu_Name;
    private int stu_Id;

    public Student(){}

    public Student(String name, int id){
        super();
        this.stu_Id = id;
        this.stu_Name = name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "stu_Name='" + stu_Name + '\'' +
                ", stu_Id=" + stu_Id +
                '}';
    }

    public String getStu_Name() {
        return stu_Name;
    }

    public void setStu_Name(String stu_Name) {
        this.stu_Name = stu_Name;
    }

    public int getStu_Id() {
        return stu_Id;
    }

    public void setStu_Id(int stu_Id) {
        this.stu_Id = stu_Id;
    }
}